<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>class类-成员</title>
</head>

<body>
  <script>
    // 自有属性
    /* class People {
      constructor() {
        this.name = "strick"
      }
    } */

    // 访问器属性
    /* class People {
      get prop() {
        return `getter:${this.name}`
      }
      set prop(value) {
        this.name = value
      }
    }

    var people = new People()
    people.prop = "strick"
    console.log(people.prop); */

    // 计算成员名
    /* var method = "getAge"
    class People {
      ["get" + "Name"]() {
        return "strick"
      }
      [method]() {
        return 28
      }
    }

    var people = new People()
    console.log(people.getName());
    console.log(people.getAge()); */

    // 生成器
    /* class People {
      *getName() {
        yield "strick"
      }
    }

    var people = new People()
        iterator = people.getName()
        console.log(iterator.next()) */

    // 也可以自定义一个Symbol.iterator生成器方法

    // 静态方法
    /* 
      静态方法只能通过类本身调用
      静态属性，也只能通过类本身进行获取和设置
    */
    class People {
      static getName() {
        return "strick"
      }
    }

    console.log(People.getName())

  </script>
</body>

</html>